package com.snowRemovingUser.controller;


import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.AjaxResult;
import com.snowRemovingUser.dto.LoginDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 除雪防滑系统的客户登录Controller
 *
 * @author liguang
 * @date 2023-04-07
 */
@RestController
@RequestMapping("/snowRemoving")
public class CustomerLoginController {



    @Autowired
    private com.snowRemovingUser.service.ICustomerLoginService ICustomerLoginService;


    /**
     * 登录方法
     *
     * @param   username  登录信息
     * @return 结果
     */
    @GetMapping("/login")
    public AjaxResult CustomerLogin(String username, String password)
    {
        LoginDto loginDto = new LoginDto();
        loginDto.setUsername(username);
        loginDto.setPassword(password);

        // 生成令牌
        return ICustomerLoginService.login(loginDto);
    }

    @Anonymous
    @GetMapping("/loginUpdate")
    public AjaxResult CustomerLoginUpdate(String username, String oldPwd, String newPwd, String accessKeyId, String accessKeySecret)
    {

        LoginDto loginDto = new LoginDto();
        loginDto.setUsername(username);
        loginDto.setOldPwd(oldPwd);
        loginDto.setNewPwd(newPwd);
        // 生成令牌
        return ICustomerLoginService.loginUpdate(loginDto);
    }
















}
